package com.sghy.xcxservice.controller.user;

import com.sghy.xcxservice.controller.BaseController;
import com.sghy.xcxservice.dto.UserInfoVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
import java.util.Objects;

@RequestMapping("/user")
@RestController
public class loginController extends BaseController {

    @PostMapping("login")
    public Map<String, Object> login(@RequestParam String username, @RequestParam String password) {
        String token = loginService.login(username, password);
        return SUS(token);
    }
    
    @PostMapping("getUserInfo")
    public Map<String, Object> getUserInfo() {
        UserInfoVo user = orgUserService.getUserInfo();
        return SUS(user);
    }

}
